livecodefandomcom-20200223-history
Install LiveCode Server on Linux with Apache
Prerequisites Apache is the most most popular web server package available today. Installing Apache will allow your machine to function as a web server, hosting websites and serving web pages. Most Linux distributions come with Apache installed by default. If not, you can either install it using the appropriate package manager for your system, download pre-built binaries for your system or build it from source. For example, on Debain based distributions, you can install Apache using apt with the following command: sudo apt-get install apache2 You will need to ensure that your install of Apache has following three modules are enabled: * mod_cgi * mod_actions * mod_alias See how to check Apache mod enabled and install them. This lessons assumes you have access to your system's Apache configuration files. If you do not, see the the lesson Install LiveCode Server with Apache via .htaccess 32bit libraries are required for LiveCode server to run on a 64bit Linux distribution These can be installed via the following (or similar) commands: yum install glibc.i686 glibc-2.12-1.107.el6_4.2.i686 yum install libgcc.i686 Download LiveCode Server Download and unzip the package into your desired location,for example in your home folder. Access Apache configuration files The location of your Apache configuration files will depend upon the setup of your system. They are often located located in either in /etc/apache2/ or /etc/httpd/. There is usually on main httpd.conf file in this folder that includes several sub configuration files. For example, on Debain based systems, the site configuration is often included in a sub folder /sites-enabled/. Set up LiveCode Server as a CGI engine Next, you need to alter the Apache configuration file so that it associates .lc extensions with the LiveCode Server engine. To do this, open up the main Apache configuration file in a text editor. Your configuration file should contain an entry like the following: DocumentRoot /var/www This details the folder where Apache looks for its web pages. This folder will have a directory directive that by default will look something like the following: Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all AddHandler livecode-script .lc Action livecode-script /livecode-cgi/livecode-server Update this directory directive to look like the following: Options Indexes FollowSymLinks MultiViews AllowOverride None Require all granted AddHandler livecode-script .lc Action livecode-script /livecode-cgi/livecode-server ScriptAlias /livecode-cgi/livecode-server /opt/livecode/LiveCodeCommunityServer-9_0_0_dp_8-Linux-x86_64/livecode-community-server Options ExecCGI Indexes FollowSymLinks MultiViews Require all granted Here /opt/livecode/LiveCodeCommunityServer-9_0_0_dp_8-Linux-x86_64/ is the full path to the folder you unzipped the LiveCode Server files into. Depending on your Linux install you may need to set ownership/permissions of livecode-server file, example: chown "" livecode-server Activate CGI also for user directories If you enabled the userdir mod, your users can have their web pages in a folder like public_html in their homes. However you user can't use the CGI, so you need to edit the file userdir.load like this way: UserDir public_html UserDir disabled root AllowOverride All Options ExecCGI MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec AddHandler livecode-script .lc Action livecode-script /livecode-cgi/livecode-server Require all granted Require all denied Restart Apache Once you have updated your configuration file, you must restart Apache. You can do this by running the following command in the terminal (may vary, depending upon you Apache install): sudo apache2ctl restart or sudo service apache2 restart Create and view a test page You are now ready to test your installation. To do this, create a file named "test.lc" in your document root folder. Your document root folder is defined in your Apache configuration file and can be found using the interactions defined in the step "Set up LiveCode Server as a CGI engine". To access the test script, navigate to http://localhost/test.lc using your browser. The above image shows the expected output if "test.lc" contains the following script: My LiveCode Server Test Page My LiveCode Server Test Page Hello World! from LiveCode Server " put " The date is" && the date & " " ?> For more detailed information on installing LiveCode server, see the server release notes distributed with the server package. Category:Server